<?php
include '../class/Uploader.class.php';
$config = array(
    "savePath" => '../module/shops/'.$_SESSION['account'],
    "maxSize" => 1024, //单位KB
    "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"),
    'simpleFolder' => 'hehe'
);
// print_r($_FILES);
// echo 1024*1024;
// exit;
$imgPath = array();
foreach($_FILES as $key=>$file){
    $filename = $key;
    $up = new Uploader($filename, $config);
    $info = $up->getFileInfo();
    if($info['state']=='SUCCESS') {
        $imgPath[$key] = $info['url'];
    }
    else {
        switch($key){
        case 'logo':
            $errmsg = "景区Logo:";
            break;
        case 'im1':
             $errmsg = "第一张首页宣传图:";
            break;
        case 'im2':
             $errmsg = "第二张首页宣传图:";
            break;
        case 'im3':
             $errmsg = "第三张首页宣传图:";
            break;
        // default:
        case 'im4':
            $errmsg = "第四张首页宣传图:";
            break;
        }
       exit($errmsg.$info['state']);
    }
}
extract($imgPath);

